﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Prism.Regions;
using ShellInfrastructure;
using ModuleOrder.Views;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Prism.Events;
using EventInfrastructure;





namespace ShopShell.OrderCommands
{
    public class CancelOrderCommand : ICommand
    {
        [Dependency]
        public IRegionManager RegionManager { get; set; }


        [Dependency]
        public IEventAggregator EventAggregator { get; set; }


        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            EventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
            EventAggregator.GetEvent<CancelOrderEvent>().Publish(true);                
        }
    }
}
